<?php
  //This has to be the first line of code a file if sessions are used.
  session_start();
  
  require_once ('check_PDO.php');
  require_once ('appinfo.php');

  if(isset($_SESSION['AppInfo'])) {
    $app = unserialize($_SESSION['AppInfo']);
    if($app->ConnURL == "") {
      header("Location: login.php"); 
      exit; 
    }
  } else {
    header("Location: login.php");
    exit; 
  }

  //Get DB connection info from session data
  include_once ('init_db_connect.php');  
  require_once ('ConnectionInfo.php'); 
  
  $connInfo = new ConnectionInfo($dbConfig['DB_DATABASE_NAME'], $dbConfig['DB_USERNAME'], 
                                  $dbConfig['DB_PASSWORD'], $dbConfig['DB_HOST'], "30000");
  $connInfo->connect();
  if(!$connInfo->conn) {
    exit;
  }
?>

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Connection information</title>
    <link rel="stylesheet" href="css/default.css">
  </head>
  <body bgcolor="#F7F7F7">
    <p align="center" class="title2"><font color="red">Connection information</font></p>
    <div style="width: 100%; padding: 15px;" align="center">
      <table>
        <tr bgcolor="#FFFFFF">
          <td width="100px;" style="padding-left: 10px; padding-right: 10px;">Server version:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->server_db_version(); ?></b></td>
        </tr>
        <tr>
          <td style="padding-left: 10px; padding-right: 10px;">Client version:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->client_db_version(); ?></b></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td style="padding-left: 10px; padding-right: 10px;">AUTOCOMMIT:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->autocommit(); ?></b></td>
        </tr>
        <tr>
          <td style="padding-left: 10px; padding-right: 10px;">ORACLE NULLs:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->ORACLE_NULLs(); ?></b></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td style="padding-left: 10px; padding-right: 10px;">Driver name:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->driver_name(); ?></b></td>
        </tr>
        <tr>
          <td style="padding-left: 10px; padding-right: 10px;">Charset:</td>
          <td style="padding-left: 10px; padding-right: 10px;"><b style="color: navy"><?php echo $connInfo->Charset(); ?></b></td>
        </tr>
      </table>
    </div>
  </body>
</html>